<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Contact extends Module {

	public $version = 0.9;

	public function info()
	{
		return array(
			'name' => array(
                'vi' => 'Liên hệ'
			),
			'description' => array(
				'vi' => 'Quản lý thông tin liên hệ được người dùng gửi lên từ trang chủ.'
			),
			'frontend' => FALSE,
			'backend' => TRUE,
			'menu' => 'content',
		);
	}

	public function install()
	{
		$this->dbforge->drop_table('contact_log');
		
		return $this->db->query("
			CREATE TABLE ".$this->db->dbprefix('contact_log')." (
			  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
			  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
			  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
			  `subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
			  `message` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
			  `company_name` VARCHAR( 255 ) NOT NULL,
			  `sender_agent` int(11) DEFAULT NULL,
			  `sender_ip` text,
			  `sender_os` int(15) NOT NULL,
			  `sent_at` varchar(255) DEFAULT NULL,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
	}

	public function uninstall()
	{
		//it's a core module, lets keep it around
		return FALSE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "This module has no inline docs as it does not have a back-end.";
	}
}
/* End of file details.php */